﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StartSearchXP
{
    public partial class options : Form
    {
        public options()
        {
            InitializeComponent();
        }

        private void options_Load(object sender, EventArgs e)
        {
            
            //event handler declarations
            this.FormClosing += new FormClosingEventHandler(options_FormClosing);

            textBox1.Text = StartSearchXP.Properties.Settings.Default.custompath_allusers;
            textBox2.Text = StartSearchXP.Properties.Settings.Default.custompath_currentuser;
        }
        //event if the form closes, asking if the user wants to save the settings
        void options_FormClosing(object sender, FormClosingEventArgs e)
        {
           
            if (MessageBox.Show("Save settings?","Wait!",MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                StartSearchXP.Properties.Settings.Default.custompath_allusers = textBox1.Text;
                StartSearchXP.Properties.Settings.Default.custompath_currentuser = textBox2.Text;
                Properties.Settings.Default.Save();
            }
           
        }
        //browse button 1
        private void button1_Click(object sender, EventArgs e)
        {   
            FolderBrowserDialog fdialog = new FolderBrowserDialog();
            fdialog.RootFolder = Environment.SpecialFolder.CommonStartMenu;
            fdialog.ShowDialog();
            textBox1.Text = fdialog.SelectedPath;
        }
        //browse button 2
        private void button2_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fdialog = new FolderBrowserDialog();
            fdialog.RootFolder = Environment.SpecialFolder.StartMenu;
            fdialog.ShowDialog();
            textBox2.Text = fdialog.SelectedPath;
        }
        //close button
        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }





    }
}
